﻿<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>后台首页 -商品规格</title>
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<!-- basic styles -->
		<link href="__STATIC__/assets/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="__STATIC__/assets/css/font-awesome.min.css" />
		<link rel="stylesheet" href="__STATIC__/font-awesome-4.7.0/css/font-awesome.min.css" />

		<!--[if IE 7]>
		  <link rel="stylesheet" href="__STATIC__/assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

		<!-- page specific plugin styles -->

		<!-- fonts -->

		<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />

		<!-- ace styles -->

		<link rel="stylesheet" href="__STATIC__/assets/css/ace.min.css" />
		<link rel="stylesheet" href="__STATIC__/assets/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="__STATIC__/assets/css/ace-skins.min.css" />
		<link rel="stylesheet" href="__STATIC__/css/public.css" />

		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="__STATIC__/assets/css/ace-ie.min.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->

		<script src="__STATIC__/assets/js/ace-extra.min.js"></script>

		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

		<!--[if lt IE 9]>
		<script src="__STATIC__/assets/js/html5shiv.js"></script>
		<script src="__STATIC__/assets/js/respond.min.js"></script>
		<![endif]-->
	</head>

	<body>

		{include file="public/header"}

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				{include file="public/sidebar"}

				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="#">首页</a>
							</li>
							<li class="active">商品规格</li>
						</ul><!-- .breadcrumb -->

					</div>

					<div class="page-content">
						<div class="page-header">
							<h1>
								商品规格
							</h1>
						</div><!-- /.page-header -->

						<div class="alert alert-block alert-success">
							<button type="button" class="close" data-dismiss="alert">
								<i class="icon-remove"></i>
							</button>

							<i class="fa fa-hand-o-right fa-lg red" aria-hidden="true"></i>
							操作说明：商品规格是购买商品时给用户选择的, 涉及到价格变动库存等, 例如:衣服的 颜色 尺寸 等
						</div>

						<div class="row">
							<div class="col-xs-3 action">
								<?php if (checkPermissions('goods_option/add', $userInfo['id'])): ?>
								<button type="button" class="btn btn-primary noborder" onclick="goodsoption_add('添加商品规格','{:url(\'add\')}','500','280')"><i class="fa fa-plus" aria-hidden="true"></i> 添加商品规格</button>
								<?php endif; ?>
							</div>
							<div class="col-xs-9">
								<div class="row">
									<form method="get">
										<div class="col-xs-1" style="float:right">
											<button type="submit" class="btn btn-primary noborder" >查询</button>
										</div>
										<div class="col-xs-3" style="float:right">
											<select name="model_id" class="form-control" >
												<option value="0" <?php if($model_id == 0) echo 'selected' ?> >所有模型</option>
												{volist name="modelInfo" id="model"}
												<option value="{$model.id}" <?php if($model_id == $model['id']) echo 'selected' ?> >{$model.name}</option>
												{/volist}
											</select>
										</div>
									</form>
								</div>
							</div>
							<div class="col-xs-12">
										<div class="table-responsive">
											<form>
												<table id="sample-table-1" class="table table-striped table-bordered table-hover">
													<thead>
														<tr>
															<th>ID</th>
															<th>规格名称</th>
															<th>所属商品模型</th>
															<th width="60%">规格项</th>
															<th style="width:15%">
																<i class="icon-time bigger-110 hidden-480"></i>
																操作
															</th>
														</tr>
													</thead>

													<tbody>
														{volist name="optionInfo" id="option"}
															<tr>
																<td class="middle">
																	{$option.id}
																</td>
																<td class="middle">
																	{$option.name}
																</td>
																<td class="middle">{$option.model_name}</td>
																<td class="middle">{$option.option}</td>
																<td class="middle">
																	<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
																		<?php if (checkPermissions('goods_option/edit', $userInfo['id'])): ?>
																		<a href="javascript:;">
																		<button type="button" onclick="goodsoption_edit('编辑商品规格','{:url(\'edit?id=\'.$option.id)}','500','280')" class="btn btn-xs btn-info"  style="margin-right:5px;" >
																			编辑
																		</button>
																		</a>
																		<?php endif; ?>
																		<?php if (checkPermissions('goods_option/delete', $userInfo['id'])): ?>
																		<a href="javascript:;">
																		<button type="button" onclick="goodsoption_del('{:url(\'delete\')}',{$option.id})" class="btn btn-xs btn-info"  style="margin-right:5px;" >
																			删除
																		</button>
																		</a>
																		<?php endif; ?>
																	</div>

																	<div class="visible-xs visible-sm hidden-md hidden-lg middles">
																		<div class="inline position-relative">
																		<?php if (checkPermissions('goods_option/edit', $userInfo['id'])): ?>
																		<a href="javascript:;">
																		<button type="button" onclick="goodsoption_edit('编辑商品属性','{:url(\'edit?id=\'.$option.id)}','500','280')" class="btn btn-xs btn-info"  style="margin-right:5px;" >
																			编辑
																		</button>
																		</a>
																		<?php endif; ?>
																			<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
																				<li>
																					<a href="#" class="tooltip-info" data-rel="tooltip" title="" data-original-title="View">
																						<span class="blue">
																							<i class="icon-zoom-in bigger-120"></i>
																						</span>
																					</a>
																				</li>

																				<li>
																					<a href="#" class="tooltip-success" data-rel="tooltip" title="" data-original-title="Edit">
																						<span class="green">
																							<i class="icon-edit bigger-120"></i>
																						</span>
																					</a>
																				</li>

																				<li>
																					<a href="#" class="tooltip-error" data-rel="tooltip" title="" data-original-title="Delete">
																						<span class="red">
																							<i class="icon-trash bigger-120"></i>
																						</span>
																					</a>
																				</li>
																			</ul>
																		</div>
																	</div>
																</td>
															</tr>
														{/volist}
													</tbody>
												</table>
											</form>
											{$pageHtml}
										</div><!-- /.table-responsive -->
									</div>
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->

			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->

		<script src="__STATIC__/assets/js/jquery-2.0.3.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
<script src="__STATIC__/assets/js/jquery-2.0.3.min.js"></script>
<![endif]-->

		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='__STATIC__/assets/js/jquery-2.0.3.min.js'>"+"<"+"script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='__STATIC__/assets/js/jquery-1.10.2.min.js'>"+"<"+"script>");
</script>
<![endif]-->

		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='__STATIC__/assets/js/jquery.mobile.custom.min.js'>"+"<"+"script>");
		</script>
		<script src="__STATIC__/assets/js/bootstrap.min.js"></script>
		<script src="__STATIC__/assets/js/typeahead-bs2.min.js"></script>

		<!-- page specific plugin scripts -->

		<!--[if lte IE 8]>
		  <script src="__STATIC__/assets/js/excanvas.min.js"></script>
		<![endif]-->

		<script src="__STATIC__/assets/js/jquery-ui-1.10.3.custom.min.js"></script>

		<!-- ace scripts -->

		<script src="__STATIC__/assets/js/ace-elements.min.js"></script>
		<script src="__STATIC__/assets/js/ace.min.js"></script>
		<script src="__STATIC__/layui-v2.2.45/layui.all.js"></script>

		<!-- inline scripts related to this page -->

		<script type="text/javascript">
			/*添加商品属性*/
		 	function goodsoption_add(title,url,width,height){
		 		layer.open({
		 			//0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
		 			type:2,
		 			area:[width+'px',height+'px'],
		 			fix:false,	//不固定
		 			maxmin:true,
		 			//遮罩,默认是0.3透明度
		 			shade:0.4,
		 			title:title,
		 			//如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
		 			content:url
		 		});
		 	}

		 	/*删除商品属性*/
		 	function goodsoption_del(url,id){
		 		$.ajax({
					type:"post",
					url:url,
					data:"id="+id,
					success:function(msg){
						if(msg=='succ'){
							setTimeout(function(){
								parent.location.reload();
							},1900);
							layer.msg('商品规格删除成功！',{icon:6,time:1500});
						} else if(msg=='error'){
							layer.msg('商品规格删除失败！',{icon:5,time:1500});
						}else{
							layer.msg(msg,{icon:2,time:1500});
							setTimeout(function(){
								location.reload();
							},1900);
						}
					}
				});
		 	}

		 	/*编辑商品属性*/
		 	function goodsoption_edit(title,url,width,height){
		 		layer.open({
		 			//0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
		 			type:2,
		 			area:[width+'px',height+'px'],
		 			fix:false,	//不固定
		 			maxmin:true,
		 			//遮罩,默认是0.3透明度
		 			shade:0.4,
		 			title:title,
		 			//如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
		 			content:url
		 		});
		 	}

		</script>
	<div style="display:none"><script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script></div>
</body>
</html>

